<?php
header("Content-Type:text/html;charset=utf-8"); 
if(isset($_POST['str'])){
	if(!checkEnterStr($_POST['str'])){
		echo "特殊符号";
	}else{
		echo "正确";
	}
}
if(isset($_POST['str2'])){
	if(!checkEnterStr2($_POST['str2'])){
		echo "特殊符号";
	}else{
		echo "正确";
	}
}
function checkEnterStr($str){
	if(is_array($str)){
		foreach ($str as $key => $value) {
			if(!checkEnterStr($value)){
				return false;
			}
		}
		return true;
	}else{
		if(!empty($str)){
			if(!preg_match("/^[A-Za-z0-9]/",$str)){
				if(!preg_match("/^[\x{4e00}-\x{9fa5}]/u",$str)){
					return false;
		 		}
			}
		}
		return true;
	}
}
function checkEnterStr2($str){
	if(!empty($str)){
		if(!preg_match("/['\"]/",$str)){
			return false;
		}
	}
	return true;
}
?>
<form action="checkEnterStr.php" method="post">
	<!-- <input type="text" name="str[]" /><br>
	<input type="text" name="str[]" /><br>
	<input type="text" name="str[]" /><br> -->
	<input type="submit" value="提交" /><br>
	<input type="text" name="str2" /><br>
</form>